﻿namespace UpdateApp.Config
{
    /// <summary>
    /// 基础数据上下文
    /// </summary>
    internal class BasicDataContext : NotifyPropertyObject
    {
        private decimal _progressbarValue;
        /// <summary>
        /// 进度值
        /// </summary>
        public decimal ProgressbarValue
        {
            get { return _progressbarValue; }
            set
            {
                _progressbarValue = value;
                RaisePropertyChanged(nameof(ProgressbarValue));
            }
        }

        private string _downloadShow = "Hidden";
        /// <summary>
        /// 下载成功文件显示
        /// </summary>
        public string DownloadShow
        {
            get { return _downloadShow; }
            set
            {
                _downloadShow = value;
                RaisePropertyChanged(nameof(DownloadShow));
            }
        }

        private string _filePath;
        /// <summary>
        /// 文件地址
        /// </summary>
        public string FilePath
        {
            get { return _filePath; }
            set
            {
                _filePath = value;
                RaisePropertyChanged(nameof(FilePath));
                RaisePropertyChanged(nameof(ShowFilePath));
                RaisePropertyChanged(nameof(InstallBtnEnable));
            }
        }

        /// <summary>
        /// 文件显示路径
        /// </summary>
        public string ShowFilePath
        {
            get => $"文件路径：{_filePath}";
            set { }
        }

        /// <summary>
        /// 安装按钮是否显示
        /// </summary>
        public bool InstallBtnEnable
        {
            get => !string.IsNullOrWhiteSpace(_filePath);
            set { }
        }
    }
}
